package com.szrt.ch04.dao.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.szrt.ch04.DBUtil;
import com.szrt.ch04.dao.UserDao;
import com.szrt.ch04.dto.PageDTO;
import com.szrt.ch04.entity.UserEntity;



public class UserDaoImpl implements UserDao {

	@Override
	public List<UserEntity> findWithPage(PageDTO page) {
		try {
		Connection conn = DBUtil.getConn();
		String sql="select ID as id,USERNAME as phone ,PASSWORD as password from tmall_user_t limit ?,?";
		PreparedStatement ps = conn.prepareStatement(sql);
		
			ps.setInt(1, (page.getCurrentPage()-1)*page.getPageSize());
		
		ps.setInt(2,page.getPageSize());
		System.out.println(sql);
		
		ResultSet rs = ps.executeQuery();
		
		List<UserEntity> list=new ArrayList<UserEntity>();
		while(rs.next()){
			UserEntity entity=new UserEntity();
			
			
			
		}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return null;
	}

}
